﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Devolucao.aspx.cs" Inherits="Locadora.Views.Filme.Devolucao" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
    
     <div class="corpo">
     <h2>Devolução de Filme</h2>
        <div class="notes">
            <h4>Informações</h4>
            <p>
                Please enter your full email address, for example, <strong>name@domain.com</strong></p>
            <p>
                It is important that you provide a valid, working email address that you have access
                to as it must be verified before you can use your account.</p>
            <p>
                Please enter a land line number, not a mobile phone number.</p>
            <p class="last">
                Your phone number will not be shared or used for telemarketing. Your information
                is protected by our <a title="View our Privacy Policy" href="http://jeffhowden.com/legal/privacy_policy/">
                    Privacy Policy</a>.</p>
    </div>
     <% if (ViewData["ErrorMessage"] != null)
        { %>
        <p class=erro>
            Ocorreu um erro:
            <br />
            <%= ViewData["ErrorMessage"] %>
            </p>
        <% } %>
        
        <p>Total Filme(s): <strong><%= ViewData["totalUsers"] %></strong></p>
        
         <% if ((int)ViewData["totalUsers"] == 0)
         { %>
                <p>Não existe filme(s).</p>
        <% }
       else
       { %>    
        <table border="1" class=list>
        <tr>
        <th></th>
        <th>Id</th>
        <th>Título</th>
        <th>Estado</th>
        <th>Retirada</th>
        <th>Devolucao</th>
        <th>Notificação</th>
        </tr>
        
            <% foreach (Locadora.TOB.LocacaoTOB item in (List<Locadora.TOB.LocacaoTOB>)ViewData.Model)
               { %>
            <tr>
                <td>
                <%if (item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Aceito)
                  { %>
                    <%= Html.ActionLink("Devolver", "Devolver", new { id = item.CO_DVD, coLocacao = item.CO_SEQ_LOCACAO })%>
                <%} %>
                
                <%if (item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Solicitado || item.ST_LOCACAO == (int)Locadora.TOB.Enumeracao.SituacaoLocacao.Reserva){ %>
                    <%= Html.ActionLink("Cancelar", "Cancelar", new { id = item.CO_DVD, coLocacao = item.CO_SEQ_LOCACAO })%>
                <%} %>
                </td>
                <td>
                    <%= Html.Encode(item.CO_SEQ_LOCACAO) %>
                </td>
                <td>
                    <%= Html.Encode(item.DS_TITULO) %>
                </td>
                <td>
                    <%= Html.Encode((Locadora.TOB.Enumeracao.SituacaoLocacao)item.ST_LOCACAO)%>
                </td>
                <td>
                <%if(item.DT_LOCACAO != null){ %>
                    <%= Html.Encode(item.DT_LOCACAO.Value.ToShortDateString())%>
                    <%} %>
                </td>
                <td>
                <%if(item.DT_DEVOLUCAO != null){ %>
                    <%= Html.Encode(item.DT_DEVOLUCAO.Value.ToShortDateString())%>
                    <%} %>
                </td>
                <td>
                    <% if (item.DT_DEVOLUCAO!=null && item.DT_DEVOLUCAO < DateTime.Now){ %>
                        Atrasado - Multa
                   <%} %>
                </td>
            </tr>
            <% } %>
        </table>
        <%}%>
</div>
        
</asp:Content>
